import request from '@/utils/request';
import { SupplierTable } from '@/api/group/supplier/types';
import Qs from 'qs';
/**
 * 测试接口
 * @param data
 * @returns
 */
// import { supplierTest } from '@/api/group/supplier/index';
export const supplierTest = (data?: null) => {
  return request({
    url: '/basic/hmSupplier/editTest',
    method: 'post',
    data
  });
};

/**
 * 查询供应商列表
 * @param data
 * @returns
 */
export const hmSupplierList = (data?: SupplierTable) => {
  return request({
    url: '/basic/hmSupplier/list',
    method: 'get',
    params: data
  });
};

/**
 * 查询供应商列表(根据登录账号品类筛选)
 * @param data
 * @returns
 */
export const loginSupplierList = (data?: SupplierTable) => {
  return request({
    url: '/basic/hmSupplier/loginSupplierList',
    method: 'post',
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
    data: Qs.stringify(data)
  });
};

/**
 * 查询供应商列表(根据登录账号筛选)
 * @param data
 * @returns
 */
export const loginSupplierByRoleList = (data?: any) => {
  return request({
    url: '/basic/hmSupplier/loginSupplierByRoleList',
    method: 'post',
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
    data: Qs.stringify(data)
  });
};

/**
 * 新增供应商
 * @param data
 * @returns
 */
export const hmSupplierAdd = (data?: SupplierTable) => {
  return request({
    url: '/basic/hmSupplier/add',
    method: 'post',
    data: data
  });
};
/**
 * 修改供应商
 * @param data
 * @returns
 */
export const hmSupplierPut = (data?: SupplierTable) => {
  return request({
    url: '/basic/hmSupplier',
    method: 'put',
    data: data
  });
};

/**
 * 供应商详情
 * @param data
 * @returns
 */
export const hmSupplierGet = (id?: string | number) => {
  return request({
    url: '/electroniccommerce/hmSupplier/' + id,
    method: 'get'
  });
};

/**
 * 供应商删除
 * @param data
 * @returns
 */
export const hmSupplierDelete = (ids?: string) => {
  return request({
    url: '/electroniccommerce/hmSupplier/' + ids,
    method: 'delete'
  });
};

/**
 * 导出供应商
 * @param data
 * @returns
 */
export const hmSupplierExport = (data?: any) => {
  return request({
    url: '/electroniccommerce/hmSupplier/export',
    method: 'post',
    data: data
  });
};
